<template>
    <el-container>
        <el-container style="height: 520px">
            <el-header>
                <el-form inline label-width="49px" :model="queryList" style="margin-top: 5px; width: 100%">
                    <el-input placeholder="---请输入仓库编号---" v-model="queryList.warehouseCode" style="width: 180px" @keyup.enter="$refs.mytable.getData()"/>&nbsp;
                    <el-input placeholder="---请输入仓库名称---" v-model="queryList.warehouseName" style="width: 180px" @keyup.enter="$refs.mytable.getData()"/>&nbsp;
                    <el-select placeholder="---请选择状态---" v-model="queryList.status" style="width: 180px">
                        <el-option label="---请选择---" value />
                        <el-option v-for="item in optionsState" :key="item.value" :label="item.label" :value="item.value" />
                    </el-select>&nbsp;
                    <el-button type="primary" @click="$refs.mytable.getData()">查询</el-button>
                </el-form>
            </el-header>
            <el-foot>
                <scTable ref="mytable" :queryType="queryType" :data="listData" :queryList="queryList" :column="columnList"
                    :orderList="OrderList" :sort-orders="['ascending', 'descending']" @selection-change="selectionChange"
                    row-key="warehouseId" key="warehouseId" stripe show-summary remoteSummary
                    style="height: 450px; min-width: 420">
                    <el-table-column type="selection" width="50"></el-table-column>
                    <el-table-column label="仓库编码" prop="warehouseCode" width="120" sortable></el-table-column>
                    <el-table-column label="仓库名称" prop="warehouseName" width="140" sortable show-overflow-tooltip></el-table-column>
                    <el-table-column prop="address" label="地址" width="120" sortable show-overflow-tooltip></el-table-column>
                    <el-table-column prop="warehouseTypeDesc" label="类型" width="140" sortable></el-table-column>
                    <el-table-column prop="Remarks" label="备注" width="100" sortable show-overflow-tooltip></el-table-column>
                    <el-table-column label="状态" prop="statusDesc" sortable></el-table-column>
                </scTable>
            </el-foot>
        </el-container>
    </el-container>
</template>

<script>
import publicjs from "@/api/model/publicjs";
export default {
    name: "typelist",
    components: {
        publicjs,
    },
    props: {
        queryType: { type: String, default: "warehouse/pages" },
        queryList: { type: Object, default: {} },
    },
    data() {
        return {
            selectionRows: [],
            pkList: ["warehouseId"],
            attrList: {},
            valueList: {},
            result: "", // 运行结果
            props1: {
                checkStrictly: true,
                emitPath: false,
            },
            group: [],
            optionsUomCode: [],
            goodsTypeTree: [],
        };
    },
    methods: {
        //表格选择后回调事件
        selectionChange(selection) {
            this.selectionRows = selection;
        },
        async opBindData() {
            this.$refs.mytable.getData();
        },
        async initOptions() {
            try {
                var returnValue = await this.$API.auth.PostProcessApi.post(
                    "base-dictionary/options",
                    { Codes: ["Status"] }
                );
                if (returnValue.status == 200) {
                    this.optionsState = returnValue.response.find(
                        (p) => p.code == "Status"
                    ).optionsDetails;
                } else {
                    this.$message.error("操作失败:" + returnValue.msg);
                }
            } catch (error) {
                this.loading = false;
                return false;
            }
        },
    },
    async mounted() {
        await this.initOptions();
        await this.opBindData();
    },
};
</script>
